

--模拟弹道
local buff = ac.buff['弹道设置']
buff.model1 = [[Abilities\Weapons\MoonPriestessMissile\MoonPriestessMissile.mdl]]
buff.model2 = [[Abilities\Weapons\LordofFlameMissile\LordofFlameMissile.mdl]]
buff.cover_type = 1
buff.cover_max = 1
buff.keep = true
function buff:on_add()
    local hero = self.owner
    self:gc(hero:event '单位-攻击出手'(function(_,source,target)
        local data = {}
        local model1 = hero:get_data('弹道模型') or hero:get_slk('Missileart')
        data.start = source:get_launch_point()
        data.count = hero:get('多重射')

        source:notify('单位-攻击出手前',source,target,data)
        
        local list = {target}
        if data.count>0 then
            local area = math.min(hero:get('攻击距离')+100,1200)
            local group = ac.selector('unit'):range(hero,area):enemy(hero):is_not(target):near(target):get()
            for a=1,data.count do
                table.insert(list,group[a])
            end
        end
        for _,unit in ipairs(list) do
            data.start:launch_missile(unit,model1,1200,0,function()
                local damage = hero:get('攻击')
                if unit==target then
                    source:create_damage(unit,damage,'普攻')
                else
                    source:create_damage(unit,damage * hero:get('多重伤害')*0.01)
                end
            end)
        end
        source:notify('单位-攻击出手后',source,target)

        return true
    end))
end


ac.game:event '玩家-选择英雄完毕'(function(_,player,hero)
    hero:add_buff '弹道设置'{}
end)